/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package au.edu.swin.bank.persistence.entity;

import java.io.Serializable;
import java.math.BigInteger;
import java.util.Date;

/**
 *
 * @author scott
 */
public class BankTransactionDTO implements Comparable<BankTransactionDTO>, Serializable {
    private BigInteger srcAccountId;
    private BigInteger destAccountId;
    private String description;
    private Date date;
    private String type;
    private double amount;

    public Date getDate() {
        return date;
    }

    public String getDescription() {
        return description;
    }

    public BigInteger getDestAccountId() {
        return destAccountId;
    }

    public BigInteger getSrcAccountId() {
        return srcAccountId;
    }

    public String getType() {
        return type;
    }

    public double getAmount() {
        return amount;
    }

    public int compareTo(BankTransactionDTO t) {
        int lastCmp = date.compareTo(t.getDate());
        return lastCmp;
        //return (lastCmp != 0 ? lastCmp : firstName.compareTo(t.firstName));
    }

    public BankTransactionDTO(BankTransaction aTransaction) {
        srcAccountId = aTransaction.getFrmaccountid();
        destAccountId = aTransaction.getRecaccountid();
        description = aTransaction.getDescription();
        date = new Date();
        date.setTime(aTransaction.getDate().longValue());
        type = aTransaction.getBankTransactionType().getTranstype().toString();
        amount = aTransaction.getAmount();
    }
}
